package com.timoon.webcomponent.utility.sort;

import java.util.Arrays;

import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.markup.repeater.data.GridView;
import org.apache.wicket.markup.repeater.data.IDataProvider;
import org.apache.wicket.markup.repeater.data.ListDataProvider;

import com.timoon.page.Page1;

/**
 *<p></p>
 *<p></p>
 *<p>Copyright:Copyright(c)2013.4.1</p>
 *<p>Company:timoon</p>
 *@author 付乐天
 *@version 1.0 */
public class Cell1Panel extends Panel {

	public Cell1Panel(String id) {
		super(id);
		// TODO Auto-generated constructor stub
		
		renderName();
		
		renderSort();
	}

	@SuppressWarnings("unchecked")
	private void renderSort() {
		// TODO Auto-generated method stub
		
		IDataProvider<String> data=new ListDataProvider(Arrays.asList("fewa","fewafa","fewafa","fewafa","fewafa","fewafa","fewafa","fewafa","fewafa","fewafa","fewafa","fewafa"));
		GridView gridView=new GridView("rows",data){

			@Override
			protected void populateEmptyItem(Item arg0) {
				// TODO Auto-generated method stub
				BookmarkablePageLink link=new BookmarkablePageLink("wk_link", Page1.class);
				arg0.add(link);
				
				link.add(new Label("wk_label", "name"));		
				
			}

			@Override
			protected void populateItem(Item arg0) {
				// TODO Auto-generated method stub
				
				BookmarkablePageLink link=new BookmarkablePageLink("wk_link", Page1.class);
				arg0.add(link);
				
				link.add(new Label("wk_label", "name"));
			}
			
		};
		gridView.setColumns(3);
		add(gridView);
	}

	private void renderName() {
		// TODO Auto-generated method stub
		add(new Label("wk_name","name"));
	}

}
